package com.dada.service.admin;

import com.dada.domain.admin.AdminInfo;
import com.dada.repository.test.AdminRepository;
import com.dada.test.domain.tables.pojos.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jianweilin on 16/9/5.
 */
@Service
public class AdminService {
    @Autowired
    private AdminInfo adminInfo;

    @Autowired
    private AdminRepository adminRepository;

    /**
     * 根据Id查询用户
     */
    public List<AdminInfo> findById(Integer id){
        List<Admin> admins = adminRepository.findById(id);
        return adminInfo.toInfoList(admins);
    }

}
